# coding=utf-8
from appium import webdriver
from util.write_user_command import WriteUserCommand
class BaseDriver:
    def android_driver(self, i):

        wirte_file = WriteUserCommand()
        device_name = wirte_file.get_value('user_info_'+str(i), 'deviceName')
        port = wirte_file.get_value('user_info_'+str(i), 'port')
        caps = {}
        devices = "127.0.0.1:62001"
        caps["platformName"] = "android"
        caps["deviceName"] = device_name
        caps["appPackage"] = "com.HaiwellCloud"
        caps["appActivity"] = "com.dosingle.MainActivity"
        # caps["app"] = '../HaiwellCloud.apk'
        caps["autoGrantPermissions"] = True
        caps["skipServerInstallation"] = True
        caps["skipDeviceInitialization"] = True
        caps["noReset"] = True
        caps["ensureWebviewsHavePages"] = True
        driver = webdriver.Remote("http://localhost:"+port+"/wd/hub", caps)
        driver.implicitly_wait(10)
        return driver
    def ios_driver(self):
        pass

    def get_driver(self):
        # devices_name
        # port
        pass
